home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_q_t / splshscr.zip / SPLASH.PAS next >
Pascal/Delphi Source File  |  1992-03-14  |  2KB  |  87 lines

  1. unit SPLASH;
  2.  
  3. interface
  4.  
  5. {$R splash.res}
  6.  
  7. uses WinTypes, WinProcs, WObjects;
  8.  
  9. const
  10. id_OpenBmp = 'OPENBMP';
  11. timer_ID =1;
  12.  
  13. type
  14.  
  15. {Declare TPicWindow, a TWindow descendant }
  16.  PPicWindow = ^TPicWindow;
  17.  TPicWindow = Object(TWindow)
  18.    procedure SetupWindow; virtual;
  19.    procedure WMTimer(var Msg: TMessage);
  20.      virtual wm_First + wm_Timer;
  21.    Constructor Init(AParent: PWindowsObject; AStyle : LongInt);
  22.    Procedure Paint(PaintDC : HDC; Var PaintInfo : TPaintStruct); virtual;
  23.    function GetClassName: PChar; Virtual;
  24.    procedure GetWindowClass(var AWndClass: TWndClass); virtual;
  25.  end;
  26.  
  27. var
  28.   hOpenBmp : HBitmap;
  29.  
  30. implementation
  31.  
  32. {TPicWindow}
  33. Procedure TPicWindow.SetupWindow;
  34. begin
  35.   TWindow.SetupWindow;
  36.   SetTimer(hWindow, timer_ID, 10000, nil);
  37. end;
  38.  
  39. Constructor TPicWindow.Init(AParent : PWindowsObject; AStyle : LongInt);
  40.  
  41. Begin
  42.   TWindow.Init(AParent,'');
  43.   with Attr do
  44.   begin
  45.     Style := AStyle;
  46.     X := 110; Y := 100; W := 390; H := 255;
  47.   end;
  48.   hOpenBmp := LoadBitmap(HInstance,id_OpenBmp);
  49. End;
  50.  
  51. procedure TpicWindow.WMTimer;
  52. Begin
  53.   DeleteObject(hOpenBmp);
  54.   KillTimer(hWindow, timer_ID);
  55.   TWindow.CloseWindow;
  56. End;
  57.  
  58. function TPicWindow.GetClassName: PChar;
  59. begin
  60.   GetClassName := 'PicWindow';
  61. end;
  62.  
  63. procedure TPicWindow.GetWindowClass(var AWndClass: TWndClass);
  64. begin
  65.   TWindow.GetWindowClass(AWndClass);
  66. end;
  67.  
  68. Procedure TPicWindow.Paint(PaintDC : HDC; Var PaintInfo : TPaintStruct);
  69. Var
  70.   OldBitmap : HBitmap;
  71.   MemDC : HDC;
  72.   BitmapSize : TPoint;
  73.   BmpInfo : TBitmap;
  74.  
  75. Begin
  76.   MemDC := CreateCompatibleDC(PaintDC);
  77.   OldBitmap := SelectObject(MemDC,hOpenBmp);
  78.   GetObject(hOpenBmp,SizeOf(TBitmap),@BmpInfo);
  79.   BitmapSize.x := BmpInfo.bmWidth;
  80.   BitmapSize.y := BmpInfo.bmHeight;
  81.   BitBlt(PaintDC,0,0,BitmapSize.x,BitmapSize.y,MemDC,0,0,srcCopy);
  82.   SelectObject(MemDC,OldBitmap);
  83.   DeleteDC(MemDC);
  84. End;
  85. end.
  86.  
  87.